package com.zw.mes.module.tecdrawsign.service;

import com.zw.mes.entity.sys.User;
import com.zw.mes.entity.technology.DrawSign;
import com.zw.mes.module.tecdrawsign.mapper.DrawCJSignMapper;
import com.zw.mes.module.tecdrawsign.model.DrawSignModel;
import com.zw.mes.util.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author mayongfeng
 * @version 1.0.0
 * @ClassName DrawCJSignService.java
 * @Description TODO
 * @createTime 2021年03月25日 13:41:00
 */
@Service
@SuppressWarnings("all")
public class DrawCJSignService {

    @Autowired
    private DrawCJSignMapper drawCJSignMapper;


    public List<DrawSignModel> getCJAll(DrawSignModel drawSignModel) {
        Integer deptId = ShiroUtils.getUser().getDeptId();
        if(deptId!=47){
            drawSignModel.setSectionId(deptId);
        }
        return drawCJSignMapper.getCJAll(drawSignModel);
        
    }

    public List<DrawSignModel> getChaCJAll(DrawSignModel drawSignModel) {
         Integer deptId = ShiroUtils.getUser().getDeptId();
         if(deptId!=47){
             drawSignModel.setSectionId(deptId);
         }
        return drawCJSignMapper.getChaCjAll(drawSignModel);
    }

    public int updateCjSign(Integer id, Integer changeType) {
        int i=0;
        if(changeType==1){
            i = drawCJSignMapper.updateCjSign(id, ShiroUtils.getUser().getName());
        }else if(changeType==2){
            i = drawCJSignMapper.updateChaCjSign(id,ShiroUtils.getUser().getName());
        }

        return i;
    }
}
